﻿<#include "include/_meta.html">
<title>管理员列表</title>
</head>
<body>
<div class="page-container">
	<table id="userListTable" width="700px" border="1" class="table table-border table-bordered table-bg table-hover">
		<thead>			
			<tr class="text-c">						
				<th width="50"><input type="checkbox" name="uid" id="uid" value=""></th>
				<th width="100">编号</th>
				<th width="300">操作权限代码</th>
				<th width="200">权限名称</th>				
				<th width="300">操作</th>				
			</tr>
		</thead>
		<tbody>
			<#list resList as res>
				<tr>
				<td width="50"><input type="checkbox" name="useritem" value="${res.permisid}"></td>
				<td width="100">${res.permisid}</td>
				<td width="300">${res.permiscode}</td>
				<td width="200">${res.permisname}</td>				
				<td width="300">
				<a href="javascript:;" class="btn btn-primary radius" name="${res.permisid}" onclick="fun_resource_edit('修改权限信息3334','/resourcesedit?permisid='+${res.permisid},'600','500')">修改</a>&nbsp;&nbsp;&nbsp;
				
				<a href="javascript:;" name="${res.permisid}" class="btn btn-primary radius" onclick="fun_resource_del(${res.permisid})">删除</a>
				</td>
				</tr>	
			</#list>
		</tbody>
	</table>
</div>
<#include "include/_footer.html">

<script type="text/javascript">

$("#searchUsers").click(function() {
    	var i_data = $('#likeUsername').val();
    	console.log("datemin:"+ $('#datemin').val());
    	console.log("datemax:"+ $('#datemax').val());

        $("#userListTable").dataTable().fnClearTable();
        initTable();
});
var datadel = function(){
	alert("kjkj");
	/*
	//判断选择项是否为空
	var checkedNum = $("input[name='useritem']:checked").length;
	if(checkedNum==0){
		layer.msg('请选中要删除的列表项!',{icon: 5,time:1000});
		return;
	}
	//获取选择项的值
	var checkedVal = "";
	$("input[name='useritem']:checked").each(function(){  
		checkedVal+=$(this).val()+",";  
	});
	
	var itemsTipStr = "这条记录";
	if(checkedNum>1){
		itemsTipStr = "这些选项";
	}
	
	layer.confirm('确认要删除'+itemsTipStr+'吗？',function(){
	
		//此处请求后台程序，下方是成功后的前台处理……
		$.ajax({
		   type: "POST",
		   url: "/delUsers",
		   data: "usersid="+checkedVal,
		   success: function(msg){
		   		   
				layer.msg('已删除!',{icon: 5,time:1000});
				
				$("#userListTable").dataTable().fnClearTable();
		        initTable();
		   }
		});
		
	});*/
	
}


/*
	参数解释：
	title	标题
	url		请求的url
	id		需要操作的数据id
	w		弹出层宽度（缺省调默认值）
	h		弹出层高度（缺省调默认值）
*/
/*管理员-增加*/
function resource_add(title,url,w,h){
	layer_show(title,url,w,h);
}
/*管理员-删除*/
function fun_resource_del(permisid){	
	alert("删除编号为："+permisid);		
layer.confirm('确认要删除吗？',function(index){
		//此处请求后台程序，下方是成功后的前台处理……		
		$.ajax({
		   type: "POST",
		   url: "/resourcedelete",
		   data: "permisid="+permisid,
		   success: function(msg){
		       	$("#userListTable").dataTable().fnClearTable();
        		initTable();
		   }
		});
		$(obj).parents("tr").remove();
		layer.msg('已删除!',{icon:1,time:1000});
	});
}



/*管理员-编辑*/
function fun_resource_edit(title,url,w,h){
	
	layer_show(title,url,w,h);
}
/*管理员-停用*/
function admin_stop(obj,id){
	layer.confirm('确认要停用吗？',function(index){
		//此处请求后台程序，下方是成功后的前台处理……
		
		$.ajax({
		   type: "POST",
		   url: "/setUserState",
		   data: "userid="+id+"&isabled=0",
		   success: function(msg){
		       	$("#userListTable").dataTable().fnClearTable();
        		initTable();
		   }
		});
		
		$(obj).parents("tr").find(".td-manage").prepend('<a onClick="admin_start(this,id)" href="javascript:;" title="启用" style="text-decoration:none"><i class="Hui-iconfont">&#xe615;</i></a>');
		$(obj).parents("tr").find(".td-status").html('<span class="label label-default radius">已禁用</span>');
		$(obj).remove();
		layer.msg('已停用!',{icon: 5,time:1000});
	});
}

/*管理员-启用*/
function admin_start(obj,id){
	layer.confirm('确认要启用吗？',function(index){
			
		
		$.ajax({
		   type: "POST",
		   url: "/setUserState",
		   data: "userid="+id+"&isabled=1",
		   success: function(msg){
		       	$("#userListTable").dataTable().fnClearTable();
        		initTable();
		   }
		});
		
		
		//$(obj).parents("tr").find(".td-manage").prepend('<a onClick="admin_stop(this,id)" href="javascript:;" title="停用" style="text-decoration:none"><i class="Hui-iconfont">&#xe631;</i></a>');
		//$(obj).parents("tr").find(".td-status").html('<span class="label label-success radius">已启用</span>');
		//$(obj).remove();
		layer.msg('已启用!', {icon: 6,time:1000});
	});
}
</script>
</body>
</html>